﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true"
	CodeBehind="NewsList.aspx.cs" Inherits="SBACN.WebSite.Admin.NewsList" %>

<%@ Import Namespace="SBACN.WebSite.Common" %>
<%@ Register Src="../UC/Pager.ascx" TagName="Pager" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
	<script type="text/javascript">
		function DeleteListNews(id) {
			if (confirm("确认要删除吗？")) {
				document.getElementById("<%= hid_ID.ClientID%>").value = id;
				document.getElementById("<%= btn_Delete.ClientID%>").click();
			}
		}
		function Checkkeywords() {
			var keywords = $jqy.trim($jqy("#txt_KeyWords").val());
			if (keywords.length <= 0) {
				alert("请输入标题后搜索。");
				return false;
			}
			else {
				
				$jqy("#Hid_Keywords").val(keywords);
				return true;
			 }
		}

		function RefreshNewsList(code) {
			if (document.getElementById("<%= btn_NewsRefresh.ClientID%>") && (code == "<%= SystemCode%>")) {
				document.getElementById("<%= btn_NewsRefresh.ClientID%>").click();
			}
		}

		function DoLogin(e) {
			e = window.event || e;
			var key = e.keyCode || e.which;
			if (key == 13) {
				document.getElementById("<%= btn_Search.ClientID%>").click();
			}
		}
	</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table-stroke2">
		<tr align="center">
			<td class="form-body">
				标题搜索:
				<input type="text" id="txt_KeyWords" value="" runat="server" clientidmode="Static" size="80" />
				<asp:Button ID="btn_Search" CssClass="btnsearch" Text=" 搜 索 " runat="server" OnClientClick="return Checkkeywords();"
					OnClick="btn_Search_Click" />
			</td>
		</tr>
	</table>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table-stroke2">
		<tr>
			<td class="form-title2" width="58%">
				标题
			</td>
			<td class="form-title2" width="8%">
				发布时间
			</td>
			<td class="form-title2" width="8%">
				发布人
			</td>
			<td class="form-title2" width="8%">
				阅读次数
			</td>
			<td class="form-title2" width="10%">
				类型
			</td>
			<td class="form-title2" width="8%">
				编辑
			</td>
		</tr>
		<asp:Repeater ID="rpt_News" runat="server">
			<ItemTemplate>
				<tr>
					<td class="form-body">
						<%# Eval("Title").ToString().CutTo(55, 52)%>
					</td>
					<td class="form-body">
						<%# Convert.ToDateTime(Eval("CreateDate")).ToString("yyyy-MM-dd")%>
					</td>
					<td class="form-body">
						<%# Eval("CreateBy")%>
					</td>
					<td class="form-body">
						<%# Eval("ReadCount")%>
					</td>
					<td class="form-body">
						<%# SBACN.WebSite.Code.BasePage.TranslateToName(Eval("Type").ToString())%>
					</td>
					<td class="form-body">
						<a href="NewsEdit.aspx?id=<%# Eval("ID")%>&st=<%= SystemType + (IsEN ? "&en=1" : "") + (ExEdit ? "&ex=1" : "") + (IsSpa ? "&x=1" : "")%>" target="_blank">编辑</a> <a href="javascript:void(0);" onclick="return DeleteListNews('<%# Eval("ID")%>');">
								删除</a>
					</td>
				</tr>
			</ItemTemplate>
			<AlternatingItemTemplate>
				<tr style="background-color: #ccc">
					<td class="form-label">
						<%# Eval("Title").ToString().CutTo(50, 48)%>
					</td>
					<td class="form-label" >
						<%# Convert.ToDateTime(Eval("CreateDate")).ToString("yyyy-MM-dd")%>
					</td>
					<td class="form-label">
						<%# Eval("CreateBy")%>
					</td>
					<td class="form-label">
						<%# Eval("ReadCount")%>
					</td>
					<td class="form-label">
						<%# SBACN.WebSite.Code.BasePage.TranslateToName(Eval("Type").ToString())%>
					</td>
					<td class="form-label">
						<a href="NewsEdit.aspx?id=<%# Eval("ID")%>&st=<%= SystemType + (IsEN ? "&en=1" : "") + (ExEdit ? "&ex=1" : "") + (IsSpa ? "&x=1" : "")%>" target="_blank">编辑</a> <a href="javascript:void(0);" onclick="return DeleteListNews('<%# Eval("ID")%>');">
								删除</a>
					</td>
				</tr>
			</AlternatingItemTemplate>
		</asp:Repeater>
		<tr>
			<td colspan="6" class="form-body">
				<a href="NewsEdit.aspx?ad=1&st=<%= SystemType%><%= ExEdit ? "&ex=1" : ""%><%= IsEN ? "&en=1" : ""%><%= IsSpa ? "&x=1" : ""%>" target="_blank">添加</a>
			</td>
		</tr>
		<tr>
			<td colspan="6">
				<uc1:Pager ID="Pager1" runat="server" OnSelectedPageIndexChanged="BindSelectedPageIndexChanged"
					PageSize="15" />
			</td>
		</tr>
	</table>
	<div style="display: none;">
		<asp:HiddenField ID="hid_ID" Value="" runat="server" />
		<asp:Button Text="删除" ID="btn_Delete" runat="server" OnClick="btn_Delete_Click" />
		<asp:Button Text="刷新" ID="btn_NewsRefresh" runat="server" OnClick="btn_NewsRefresh_Click" />
		<asp:HiddenField ID="Hid_Keywords" runat="server" ClientIDMode="Static" />
	</div>
</asp:Content>
